home *** CD-ROM | disk | FTP | other *** search
/ Ultra Gameplayers 101 / Ultra Game Players Magazine, No. 101 - September 1997 (Imagine Publishing, Inc.)(1997).iso / pc / new_ugp.dxr / 00204_Generic Timer Class.ls < prev    next >
Encoding:
Text File  |  1997-07-10  |  563 b   |  32 lines

  1. property actions, lastTime, interval, killList
  2.  
  3. on new me, paramList
  4.   set killList to []
  5.   set actions to []
  6.   set lastTime to 0
  7.   set interval to getProp(paramList, #interval)
  8.   return me
  9. end
  10.  
  11. on AddAction me, action
  12.   append(actions, action)
  13. end
  14.  
  15. on CheckIdle me
  16.   if the ticks > (lastTime + interval) then
  17.     repeat with action in actions
  18.       TurnOn(action)
  19.     end repeat
  20.     set lastTime to the ticks
  21.     return 1
  22.   end if
  23. end
  24.  
  25. on dispose me
  26.   set actions to 0
  27.   set lastTime to 0
  28.   set interval to 0
  29.   ClearObjectList(killList)
  30.   set killList to []
  31. end
  32.